package operations;

import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class FindOperation implements IOperation{
    public void work (Booklist booklist){
        //查找图书
        System.out.println("查找图书！");
        System.out.print("请输入你要查找图书的名字:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < booklist.getUsedSize(); i++) {
            if(name.equals(booklist.getBooks()[i].getName())){
                System.out.println(booklist.getBooks()[i]);
                return;
            }
        }
        System.out.println("没有这本书！");
    }
}
